//
//  firstItems.m
//  lyxluyou
//
//  Created by mmyy on 15/10/15.
//  Copyright (c) 2015年 mmyy. All rights reserved.
//

#import "FirstItems.h"

@implementation FirstItems
@dynamic cover_s;
@dynamic name;
@dynamic vid;
@dynamic title;
+(instancetype)firstItemsWithDict:(NSDictionary *)dict
{
    FirstItems *items = [[self class] MR_createEntity];
    items.cover_s = dict[@"cover_s"];
    items.name = dict[@"name"];
    items.vid = [NSString stringWithFormat:@"%@",dict[@"id"]];
    return items;
}
+(void)removeDataAll:(BOOL)all
{
    NSArray *array = [FirstItems MR_findAll];
    for (FirstItems *items in array) {
        if ([[items title] length] != 0) {
            [items MR_deleteEntity];
            [[NSManagedObjectContext MR_defaultContext] MR_saveToPersistentStoreAndWait];
        }
        
    }

}
+(NSArray *)getArrayWithTitle:(NSString *)title
{
    NSArray *array = [FirstItems MR_findAllWithPredicate:[NSPredicate predicateWithFormat:@"title like '%@'", title]];
    return array;

}
@end
